Fix neuropixelsGLX.read and add scale/NIDQ support#95
Merged
stevevanhooser merged 3 commits intomainfrom Apr 7, 2026
Merged
Conversation
…NIDQ streams - Add 'scale' option (default: true) to read() that converts raw int16 data to volts via samples2volts(). Pass 'scale', false for raw int16 output. - Extend header() to parse NIDQ-specific fields: niAiRangeMax/Min, niMaxInt, niMNGain, niMAGain, and per-type channel counts (MN/MA/XA/DW). - Extend samples2volts() with NIDQ support using per-channel-type gains (MN channels use niMNGain, MA channels use niMAGain, XA/DW use gain=1). - Add optional channels argument to samples2volts() so correct per-channel gains are applied when reading a subset of channels. - Update test to pass 'scale', false where raw int16 output is expected. https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1
- Add testFormatReadScaled and testFormatReadScaleDefault to existing TestNeuropixelsGLX to verify scaled read returns correct double values and that scaling is the default behavior. - Add new TestNeuropixelsGLX_nidq test class covering NIDQ header parsing, per-channel-type voltage scaling (MN/MA/mixed), and scaled/unscaled read. https://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mustBePositiveerror:numChansandSRdefault to0as a sentinel for "read from .meta file", butmustBePositiverejected0. Changed tomustBeNonnegative.'scale'option toread()(default:true): Converts raw int16 data to volts usingsamples2volts(). Pass'scale', falsefor raw int16 output.header()now parsesniAiRangeMax/Min,niMaxInt,niMNGain,niMAGain, and per-type channel counts (MN/MA/XA/DW).samples2volts()applies correct per-channel-type gains for NIDQ streams.channelsargument tosamples2volts(): Ensures correct per-channel gains when reading a subset of channels.Test plan
TestNeuropixelsGLXtests pass (updated to use'scale', falsewhere int16 is expected)testFormatReadScaledandtestFormatReadScaleDefaultverify scaled output matches manualsamples2voltsconversionTestNeuropixelsGLX_nidqtest class covers NIDQ header parsing, MN/MA/mixed voltage scaling, and scaled/unscaled readhttps://claude.ai/code/session_01GQqT3LvvCKZ7tm7TCphrL1